package com.itheima.test1;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServiceTest {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(8888);
        Socket accept = ss.accept();
        InputStream is = accept.getInputStream();
         int len;
         byte[] bytes=new byte[1024];
         while ((len=is.read(bytes))!=-1){
             System.out.println(new String(bytes,0,len));
         }
         is.close();
         accept.close();
         ss.close();
    }
}
